import {sleep, wrapPromise} from '@huxy/utils';

export const allUserMock = async () => {
  await sleep(500);
  const result = {
    total: 5,
    list: [
      {
        _id: '123456',
        name: 'admin',
        email: 'admin@zys.com',
        github: 'githubid',
        wechat: 'openid',
        role: 5,
        avatar: 'https://pic2.zhimg.com/a2e68681a006bd3e60fd5b22d51cb629_im.jpg',
        active: 1,
        creator: 'huy',
        createtime: 1620628987826,
        __v: 0,
        updater: 'zys',
        updatetime: 1626883786994,
        projectId: '6098f12b099e1202a287acad',
        projectName: '控制台',
      },
      {
        _id: '1234567',
        name: 'demo',
        email: 'demo@zys.com',
        github: 'githubid1',
        role: 3,
        avatar: '',
        active: 1,
        creator: 'huy',
        createtime: 1620628987826,
        __v: 0,
        updater: 'zys',
        updatetime: 1626883786994,
        projectId: 'demo',
        projectName: 'demo',
      },
      {
        _id: '12345678',
        name: 'test',
        email: 'test@zys.com',
        weixin: 'openid1',
        role: 2,
        avatar: '',
        active: 1,
        creator: 'huy',
        createtime: 1620628987826,
        __v: 0,
        updater: 'zys',
        updatetime: 1626883786994,
        projectId: 'test',
        projectName: 'test',
      },
      {
        _id: '123456789',
        name: 'visitor',
        email: 'visitor@zys.com',
        role: 0,
        avatar: '',
        active: 1,
        creator: 'huy',
        createtime: 1620628987826,
        __v: 0,
        updater: 'zys',
        updatetime: 1626883786994,
        projectId: 'visitor',
        projectName: 'visitor',
      },
      {
        _id: '1234567890',
        name: 'unverified',
        email: 'unverified@zys.com',
        role: 0,
        avatar: '',
        active: 0,
        creator: 'huy',
        createtime: 1620628987826,
        __v: 0,
        updater: 'zys',
        updatetime: 1626883786994,
        projectId: 'unverified',
        projectName: 'unverified',
      },
    ],
    count: 1,
    current: 1,
    size: 10,
  };
  return {result};
};

export const allUserSuspenseMock = () => wrapPromise(allUserMock());
